Use the previously unused window->need_resize flag to mark if a window's
authorOwen Taylor <otaylor@gtk.org>
Tue, 12 May 1998 01:02:22 +0000 (01:02 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 12 May 1998 01:02:22 +0000 (01:02 +0000)
Mon May 11 21:04:51 1998  Owen Taylor  <otaylor@gtk.org>

* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
previously unused window->need_resize flag to mark if a window's
descendents changed size while the window was not visible. In this
case, when the window becomes visible, we reallocate everything,
since we didn't keep track of what actually changed.

(Fixes bug where changing the popdown strings of a
combo to something of the same length caused them to
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)

gtk/gtkwindow.c

index 9608b081a552baf774178627d60b6db5d897ee7e..d077514dffdde4f4b1f488c35bbb651aabc70a76 100644 (file)
@@ -1002,11 +1002,9 @@ gtk_window_need_resize (GtkContainer *container)
     return return_val;
 
   if (GTK_WIDGET_VISIBLE (container))
-    {
-      window->need_resize = TRUE;
-      return_val = gtk_window_move_resize (GTK_WIDGET (window));
-      window->need_resize = FALSE;
-    }
+    return_val = gtk_window_move_resize (GTK_WIDGET (window));
+  else
+    window->need_resize = TRUE;
   
   return return_val;
 }
@@ -1019,13 +1017,17 @@ gtk_real_window_move_resize (GtkWindow *window,
                             gint       height)
 {
   GtkWidget *widget;
+  gboolean needed_resize;
   
   g_return_val_if_fail (window != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
   g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE);
-  
+
   widget = GTK_WIDGET (window);
 
+  needed_resize = window->need_resize;
+  window->need_resize = FALSE;
+
   if ((widget->requisition.width == 0) ||
       (widget->requisition.height == 0))
     {
@@ -1065,6 +1067,21 @@ gtk_real_window_move_resize (GtkWindow *window,
                           widget->requisition.width,
                           widget->requisition.height);
     }
+  else if (needed_resize)
+    {
+      /* The windows contents changed size while it was not
+       * visible, so reallocate everything, since we didn't
+       * keep track of what changed
+       */
+      GtkAllocation allocation;
+
+      allocation.x = 0;
+      allocation.y = 0;
+      allocation.width = widget->requisition.width;
+      allocation.height = widget->requisition.height;
+      
+      gtk_widget_size_allocate (widget, &allocation);
+    }
   else
     {
       /* The window hasn't changed size but one of its children
@@ -1150,7 +1167,7 @@ gtk_real_window_move_resize (GtkWindow *window,
        }
       g_slist_free (resize_containers);
     }
-  
+
   return FALSE;
 }